//
//  ObjectCollectionCell.m
//  基本框架
//
//  Created by runone02 on 2018/8/20.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "ObjectCollectionCell.h"
#import <UIImageView+WebCache.h>
@interface ObjectCollectionCell()
/** */
@property (nonatomic, strong) UIImageView *images;
/** */
@property (nonatomic, strong) UILabel *labes;

@end

@implementation ObjectCollectionCell

#pragma mark 创建cell
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        //添加自己需要个子视图控件
        [self setUpView];
    }
    return self;
}



- (void) setUpView {
    self.backgroundColor = [UIColor whiteColor];
    _images.layer.masksToBounds = YES;
    _images.layer.cornerRadius = 35;
    _images = [[UIImageView alloc]init];
    [self addSubview:_images];
    [_images mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self);
        make.width.height.mas_equalTo(70);
    }];
    
    _labes = [[UILabel alloc]init];
    _labes.textAlignment = NSTextAlignmentCenter;
    _labes.textColor = [UIColor blackColor];
    _labes.font = TITLE_FONT(30);
    
    [self addSubview:_labes];
    [_labes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(self.images.mas_bottom).with.offset(5);
        make.left.right.mas_equalTo(self);
    }];
}

- (void)setModel:(ObjectModel *)model {
    _model = model;
    _labes.text = _model.titlestr;
    [_images sd_setImageWithURL:[NSURL URLWithString:model.img]];
}
@end
